package com.heima.wemedia;

import com.heima.model.article.vos.HotArticleVo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class TestTTT1 {
    public static void main(String[] args) {

        Integer[] arr = {1,2,5,7,4,88,66,55};
        List<Boolean> collect = Arrays.asList(arr).stream().map(e -> e > 6).collect(Collectors.toList());
        System.out.println(collect);

        List<Integer> collect1 = Arrays.asList(arr).stream().filter(integer -> integer > 6).collect(Collectors.toList());
        System.out.println(collect1);


        HotArticleVo vo1= new HotArticleVo();
        vo1.setChannelId(1);
        HotArticleVo vo2= new HotArticleVo();
        vo2.setChannelId(2);
        HotArticleVo vo3= new HotArticleVo();
        vo3.setChannelId(1);
        List<HotArticleVo> vos = new ArrayList<>();
        vos.add(vo1);
        vos.add(vo2);
        vos.add(vo3);
        List<Integer> collect2 = vos.stream().map(HotArticleVo::getChannelId).collect(Collectors.toList());
        System.out.println(collect2);

        Set<Integer> collect3 = vos.stream().map(HotArticleVo::getChannelId).collect(Collectors.toSet());
        System.out.println(collect3);


        for (Integer channelId : collect3) {
            List<HotArticleVo> collect4 = vos.stream().filter(hotArticleVo -> channelId.equals(hotArticleVo.getChannelId())).collect(Collectors.toList());
            System.out.println(collect4);
        }


    }
}
